/*Source

Problem Id:2602  User Id:Latex 
Memory:2964K  Time:187MS
Language:C++  Result:Accepted

Source 
*/
#include <stdio.h>
#include <string.h>
#include <stdio.h>

	char a[1000001], b[1000001];
	char c[1000003];
	int n;

main()
{
	char tmp[10];
	int i, g;

	//scanf("%ld", &n);
	gets(tmp);
	sscanf(tmp, "%ld", &n);
	for (i=1; i<=n; i++)
	{
		gets(tmp);
		a[i] = tmp[0] - '0';
		b[i] = tmp[2] - '0';
	}
	g = 0;
	for (i=n; i>0; i--)
	{
		c[i] = a[i] + b[i] + g;
		if (c[i] > 9)
		{
			c[i] -= 10;
			g = 1;
		}
		else 
			g = 0;
		c[i] += '0';
	}
	c[n+1] = 0;

	if (g>0)
	{
		printf("1%s\n",c+1);
	} else
	{
		printf("%s\n",c+1);
	}
		
	return 0;
}

